package com.howells.time.module.sendvideo.view;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;

import com.howells.time.R;
import com.howells.time.base.activity.BaseActivity;
import com.howells.time.base.utils.StatusBarUtil;
import com.howells.time.module.sendvideo.model.Mode;

import java.util.List;


/**
 * Created by Administrator on 2016.4.15.
 */
public class SelectModeActivity extends BaseActivity {

    private ListView listView;
    private List<Mode> list;
    private ModeListAdapter listAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select_mode);
        listView= (ListView) findViewById(R.id.listView_mode);
        list= (List<Mode>) getIntent().getSerializableExtra("listmode");
        listAdapter=new ModeListAdapter(this,list, R.layout.item_mode);
        listView.setAdapter(listAdapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent=new Intent(SelectModeActivity.this,SendVideoActivity.class);
                intent.putExtra("id",list.get(i).getId());
                intent.putExtra("modenmae",list.get(i).getName());
                intent.putExtra("maxday",list.get(i).getSaveMaxTime());
                setResult(1001,intent);
                finish();
            }
        });
        StatusBarUtil.setColor(this,0);
        ((TextView)findViewById(R.id.top_pannel_title)).setText("模式");
    }

    public void onClick(View v){
        switch (v.getId()){
            case R.id.select_address_image:
                finish();
                break;
        }
    }
}
